package com.dna.common.lang.test;


import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import com.dna.common.lang.PlugableProcess;

import junit.framework.TestCase;

//import org.junit.After;
//import org.junit.Before;
//import org.junit.Test;

public class PlugableProcessTestCase extends TestCase {

	List<PlugableProcess> toDispose;
	
//	@Before
	public void setUp() throws Exception {
		toDispose = new ArrayList<PlugableProcess>();
	}

//	@After
	public void tearDown() throws Exception {
		for(PlugableProcess p : toDispose)
			try {
				p.destroy();
			} catch (RuntimeException e) {
				continue;
			}
	}

//	@Test
	public void testPlugableTestCase() throws Exception {
		OutputStream output = new ByteArrayOutputStream();
		PlugableProcess process = new PlugableProcess("cmd.exe");
		toDispose.add(process);
		process.addOutput(output);
		/*
		 * It doesn't work with maven
		 */
//		process.start();
//		Thread.sleep(1000);
//		assertTrue(output.toString().length()>0);
	}
}
